home *** CD-ROM | disk | FTP | other *** search
- /* terms.c */
- /* JOVE/MSDOS. K. Mitchum 1/85 */
- /* Modifications for personal use only. */
- /* original code J. Payne LSRHS 5/83 */
- /* Ken Mitchum */
- /* University of Pittsburgh */
- /* Decision Systems Laboratory */
-
-
- #include "tm.h"
- #include "jove.h"
- #include "termcap.h"
- #include "term.h"
- #include "screen.h"
-
-
- extern int VisBell;
-
- /*--------------------------o.s. dependent-------------------------*/
-
- #ifdef TERMCAP
- outchar(c)
- char c;
- {
- Putc(c, (&termout));
- return;
- }
-
-
- ins_mode()
- {
- putpad(IM,1);
-
- }
- ex_ins_mode()
- {
- putpad(EI,1);
- }
-
- ins_chr()
- {
- putpad(IC,1);
- return;
- }
-
- ex_ins_chr()
- {
- putpad(EI,1);
- }
-
-
- del_chr()
- {
- putpad(DC,1);
- }
-
- wipeline()
- {
- putpad(CE,1);
- return;
- }
-
- wipescreen()
- {
- putpad(CL,LI);
- return;
- }
-
- inslines(n)
- int n;
- {
- while (n--) putpad(AL,1);
- return;
- }
-
- dellines(n)
- int n;
- {
- while (n--) putpad(DL,1);
- return;
- }
-
- SetHL()
- {
- putpad(SO,1);
- }
-
- UnSetHL()
- {
- putpad(SE,1);
- }
-
- #else /* dedicated driver */
-
-
- ins_mode()
- {
- (*tt.t_INSmode) (1);
-
- return;
- }
-
- ex_ins_mode()
- {
- (*tt.t_INSmode) (0);
- return;
- }
-
- del_chr()
- {
- (*tt.t_delchars) (1);
- return;
- }
-
- wipeline()
- {
- (*tt.t_wipeline) (1);
- return;
- }
-
- wipescreen()
- {
- (*tt.t_wipescreen) ();
- return;
- }
-
- inslines(n,bot)
- int n,bot;
- {
- (*tt.t_inslines)(n,bot);
- return;
- }
-
- dellines(n,bot)
- int n,bot;
- {
- (*tt.t_dellines)(n,bot);
- return;
- }
-
- SetHL()
- {
- (*tt.t_HLmode) (1);
- }
-
- UnSetHL()
- {
- (*tt.t_HLmode) (0);
- }
-
-
-
- outchar(c)
- char c;
- {
-
-
- if((c & 0x7f) >= ' ') putp(c);
- else {
- if(c == '\n') {
- Placur(CapLine +1, 0);
- (*tt.t_wipeline) (1);
- }
- if(c == '\t') {
- Placur(CapLine +1, 0);
- printf("TAB!!!!");
- }
- if(c == '\r') {
- Placur(CapLine,0);
- }
- }
- return;
- }
-
-
- #endif
-
- /* common routines */
-
-
- init_term()
- {
- #ifdef TERMCAP
- CanScroll = ((AL && DL) || VT);
- hasIC = ((IC || IM) && DC);
-
- hasIM = (IM && EI);
-
- putpad(CL, 1);
- if (IS)
- putpad(IS, 1);
- if (VS)
- putpad(VS, 1);
- #else
- (*tt.t_init) ();
- #endif
- return;
- }
-
- term_exit()
- {
-
- #ifdef TERMCAP
- if (VE)
- putpad(VE, 1);
- Placur(LI - 1, 0);
- putpad(CE, 1);
- flusho();
- #endif
- return;
- }
-
-
- UnsetTerm()
- {
- ttyset(0);
- #ifdef TERMCAP
- if (VE)
- putpad(VE, 1);
- Placur(LI - 1, 0);
- #endif
- outchar('\n');
- flusho();
- }
-
- ResetTerm()
- {
- #ifdef TERMCAP
- if (IS)
- putpad(IS, 1);
- if (VS)
- putpad(VS, 1);
- #endif
- ttyset(1);
-
- }
-
-
-
- #ifdef UNIX
- Putc(x,p)
- char x;
- IOBUF *p;
- {
- (--(p)->io_cnt>=0 ? ((int)(*(p)->io_ptr++=(unsigned)(x))):flushout(x, p));
- }
-
- sendbell()
- {
- #ifdef TERMCAP
- if (VisBell && VB)
- putstr(VB);
- else
- #endif
- outchar('\007');
- RingBell = 0;
- }
-
- #else
- sendbell()
- {
- bdos(6,7);
- RingBell = 0;
-
- }
-
- #endif